<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>vue中template和script标签</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>

</head>

<body>

    <!-- 模板标签，就不用写在属性template里 -->
    <template id="myTemplate">   
        <div>
          <h2>tmplate</h2>
          <h2>我是模板标签，并且有且只能有一个根标签</h2>
          <div>模板标签</div>
        </div>
    </template>

    <!-- 另一种是用script -->
    <script type="text/template" id="myTemplate">
        <div>
            <h2>script</h2>
            <h2>我是模板标签，并且有且只能有一个根标签</h2>
            <div>模板标签</div>
        </div>
    </script>
    <div id=app>
        <ik></ik>
    </div>
    <script>
        Vue.component('ik', {
            template: "#myTemplate"
        });
        new Vue({
            el: '#app'

        });
    </script>
</body>

</html>